/* 
 * BAT_Writer.h
 *
 * An output class for any format from a BAT.
 *
 * Bob Zimmermann <rpz@cse.wustl.edu>
 * Totally free.
 */

#include "BAT_Annotation.h"
#include <stdlib.h>

#ifndef BAT_WRITER_H
#  define BAT_WRITER_H

typedef struct _BAT_Writer BAT_Writer;
typedef struct _BAT_Write_Plugin BAT_Write_Plugin;

typedef enum _BAT_Writer_Type
{
  BAT_GTF_Writer_Type
} BAT_Writer_Type;

#  define BAT_WRITER_EXT_LEN 10

struct _BAT_Write_Plugin
{
  BAT_Writer_Type type;
  char ext[BAT_WRITER_EXT_LEN];
  void *(*construct) (void);
  void (*delete) (void *writer, int);
  void (*write_gene_table) (void *writer, FILE * fh, BAT_GeneTab * bat);
  void (*write_gene) (void *writer, FILE * fh, BAT_Gene * gene);
  void (*write_transcript) (void *writer, FILE * fh, BAT_Transcript * tx);
  void (*write_feature) (void *writer, FILE * fh, BAT_Feature * feat);
  void (*write_free_feature) (void *writer, FILE * fh, BAT_Free_Feature * feat);
  void (*write_attribute) (void *writer, FILE * fh, BAT_Attribute * attr);
};

struct _BAT_Writer
{
  char placeholder;
};

BAT_Writer *BAT_Writer_new ();
void BAT_Writer_delete (BAT_Writer * w, int);
void BAT_Writer_write_file (BAT_Writer * w, char *filename,
			    BAT_Writer_Type wt, void *object,
			    BAT_Object_Type t);
void BAT_Writer_write_to_fh (BAT_Writer * w, FILE * fh, BAT_Writer_Type wt,
			     void *object, BAT_Object_Type t);

#endif /* BAT_WRITER_H */
